import book.Book;
import book.BookList;
import user.AdminUser;
import user.NornmalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-17
 * Time: 8:54
 */
public class Main {
    public static User logn() {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入的你的姓名：");
        String name = scan.nextLine();
        System.out.println("Hello" + name + ", 请输入你的身份: ");
        System.out.println("1. 管理员      2.普通用户 ");

        while(true) {
            int choice = scan.nextInt();
            if (choice == 1) {
                return new AdminUser(name);
            } else if (choice == 2) {
                return new NornmalUser(name);
            } else {
                System.out.println("输入错误，请重新输入!");
            }
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();

        //登录界面
        User user = logn();
        while(true) {
            int choice = user.menu();
            user.setDooperation(choice,bookList);
        }
    }
}
